package com.gupaoedu.vip.netty.io.bio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.UUID;

/**
 * @program:gupaoedu-vip-netty-io
 * @description:同步阻塞IO模型客户端
 * @author:Gongchao
 * @date:2020-04-27
 **/
public class BIOClient {

    public static void main(String[] args) {
        //目标服务器ip，端口
        try {
            Socket socket = new Socket("localhost",8080);

            //将客户端数据发送到网络中 OutputStream
            OutputStream outputStream = socket.getOutputStream();

            String name = UUID.randomUUID().toString();
            System.out.println("客户端发送数据:"+name);

            outputStream.write(name.getBytes());
            outputStream.close();
            socket.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
